package cn.highedu.controller;

import cn.highedu.bean.LoginDTO;
import cn.highedu.service.AuthService;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AuthController {

    Logger logger = org.slf4j.LoggerFactory.getLogger(AuthController.class);

    @Autowired(required = false)
    private AuthService authService;

    @PostMapping("/auth/login")
    public String login(String username, String password){
        logger.debug("username {}, password {}", username, password);
        if(authService.login(username, password)){
            return "OK";
        }else {
            return "FAIL";
        }
    }

}
